<%@page import="org.dhbw.cocktail.UsedIngredient"%>
<%@page import="org.dhbw.cocktail.Cocktail"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/cocktailmixer.css" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>jCocktailmixer - Cocktail</title>
</head>
<body>
	<div id="wrapper">
		<div id="header">
			<c:if test="${select_cocktail}">
				<h1>Cocktails</h1>
			</c:if>
			<c:if test="${view_cocktail}">
				<h1>Cocktail</h1>
			</c:if>
		</div>
		<jsp:include page="menu.jsp"></jsp:include>
		<div id="content">
			<c:if test="${select_cocktail}">
				<h2>Cocktail ausw&auml;hlen</h2>
				<p>
				<form action="cocktails.html" method="get">
					<select name="id">
						<c:forEach items="${cocktails}" var="item">
							<option value="${item.id}">${item.name}</option>
						</c:forEach>
					</select> <input type="submit" value="ausw&auml;hlen">
				</form>
				</p>
				<h2>Cocktail erstellen</h2>
				<a href="create_cocktail.html">Neuen Cocktail erstellen</a>
			</c:if>
			<c:if test="${view_cocktail}">


				<div id=cocktail>
					<h2>${cocktail.name}</h2>
					<div id="cocktail_attributes">
						<!-- <p>
							<span class="desc_column">Name:</span> <span class="val_column">${cocktail.name}</span>
						</p> -->
						<p>
							<span class="desc_column">Alkoholisch:</span> <span
								class="val_column"><c:if
									test="${cocktail.alcoholic == true}">ja</c:if> <c:if
									test="${cocktail.alcoholic == false}">nein</c:if> </span>
						</p>
						<p>
							<span class="desc_column">Typ:</span> <span class="val_column"
								title="${cocktail.type.description}">${cocktail.type.name}</span>
						</p>
						<p>
							<span class="description">Beschreibung:</span><br> <span>${cocktail.description}</span>
						</p>
					</div>
					<h3>Zutaten</h3>
					<div id="cocktail_ingredients">
						<c:forEach items="${ingredients}" var="item">
							<p>
								<span class="cocktail_ingredient"><a
									href="ingredients.html?id=${item.ingredient.id}">${item.ingredient.name}</a>
								</span> <span class="cocktail_ingredient_amount_desc">Menge:</span> <span>${item.getNeededAmount()
									} </span> <span>${item.ingredient.unit} (<c:if
										test="${!cocktail_mixed }">${item.ingredient.amount}</c:if>
									<c:if test="${cocktail_mixed }">${item.ingredient.amount - item.getNeededAmount()*amount }</c:if>
									${item.ingredient.unit} vorhanden)</span>
							</p>
						</c:forEach>
					</div>
					<br>
					<!--  <form action="edit_cocktail.html" method="get">
						<input name="id" value="${cocktail.id }" type="hidden"> <input
							type="submit" value="editieren">
					</form>-->
					<form action="cocktails.html?id=${cocktail.id }" method="post">
						<input type="hidden" name="id" value="${cocktail.id }"><input
							type="hidden" name="mix" value="1">Zu mixende Menge: <input
							name="quantity" type="text" value="1"> <input
							type="submit" value="mixen">
					</form>
					<p id="cocktail_mixed">
						<c:if test="${cocktail_mixed }">Der Cocktail wurde ${amount } mal gemischt</c:if>
						<c:if test="${!cocktail_mixed && cocktail_mixed != null}">Der Cocktail konnte nicht gemischt werden</c:if>
					</p>

				</div>
			</c:if>
		</div>
		<br class="clear-float" />
		<div id="footer">
			<a>Impressum</a>
		</div>
	</div>
</body>
</html>